package com.happyrecyclingstation.controller.admin;

import com.happyrecyclingstation.service.ReportService;
import com.happyrecyclingstation.utils.Result;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 管理员
 */
@Data
@RestController
@RequestMapping("/admin/reports")
public class ReportController {

	@Autowired
	private ReportService reportService;

	/**
	 * 统计用户
	 * @return
	 */
	@GetMapping("/userCount")
	public Result getUserCount(){
		List<Map<String, Integer>> userCount = reportService.getUserCount();
		return Result.success(userCount);
	}

	/**
	 * 统计职位
	 * @return
	 */
	@GetMapping("/positionCount")
	public Result getPositionCount(){
		List<Long> positionCount = reportService.getPositionCount();
		return Result.success(positionCount);
	}
}
